package com.greyu.ysj.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.greyu.ysj.config.ResultStatus;
import com.greyu.ysj.entity.CbtArea;
import com.greyu.ysj.mapper.CbtAreaMapper;
import com.greyu.ysj.model.ResultModel;
import com.greyu.ysj.service.CbtAreaService;

@Service
public class CbtAreaServiceImpl implements CbtAreaService{
@Autowired 
private CbtAreaMapper cbtAreaMapper;
	@Override
	public CbtArea selectAreaByUserId(Integer userId) {
		// TODO Auto-generated method stub
		return cbtAreaMapper.selectByUserId(userId);
	}
	@Override
	public ResultModel save(CbtArea cbtArea) {
		// TODO Auto-generated method stub
		if (cbtArea.getUserId() == null || cbtArea.getAccount() == null) {
            return ResultModel.error(ResultStatus.DATA_NOT_NULL);
        }
		
		this.cbtAreaMapper.insert(cbtArea);
	
		return ResultModel.ok(cbtArea);
	}

}
